function delay(durtion) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
     reject('error');
    }, durtion);
  });
}

async function main() {
  for (let i = 0; i < 5; i++) {
    tr
    await delay(1000);
    console.log('ok');
  }
}
main();
